package com.tianyadu.security.service.impl;

import org.springframework.social.connect.Connection;
import org.springframework.social.connect.ConnectionSignUp;
import org.springframework.stereotype.Component;

/**
 * @FileName: DefaultConnectionSignUp
 * @Description:
 * @author: xueyj
 * @create: 2018-12-24 18:44
 */
@Component
public class DefaultConnectionSignUp implements ConnectionSignUp {

    /**
     * Sign up a new user of the application from the connection.
     * @see org.springframework.social.connect.ConnectionSignUp#execute(org.springframework.social.connect.Connection)
     * @param connection the connection
     * @return the new user id. May be null to indicate that an implicit local user profile could not be created.
     */
    @Override
    public String execute(Connection<?> connection) {
        //根据社交用户信息默认创建用户并返回用户唯一标识
        return connection.getDisplayName();
    }
}